#pragma once
#include <unordered_map>
#include <functional>
#include <string>
#include <vector>
#include <memory>
#define IMGUI_DEFINE_MATH_OPERATORS
#include "imgui_internal.h"
#include "Imgui.h"

class NSVGimage;

struct Svg
{
public:
	Svg(std::string path, std::string name);
	~Svg();

	void draw(ImVec2 cursor, ImVec2 size, float angle, bool hovered);

	NSVGimage* m_nSvgImage;
	std::string m_nName;

	static void xformPoint(float* dx, float* dy, float x, float y, float* t);
	static void xformSetTranslation(float* t, float tx, float ty);
	static void xformIdentity(float* t);
	static void xformSetScale(float* t, float sx, float sy);
	static void xformSetRotation(float* t, float a);
	static void xformMultiply(float* t, float* s);
};
struct SvgItem
{
	std::string name;
	std::string showName;
	std::shared_ptr<Svg> svg;
	SvgItem(){}
	SvgItem(std::string _name, std::string _showName, std::shared_ptr<Svg> _svg) :name(_name), showName(_showName), svg(_svg) {}
};
class SvgManager
{
public:
	static SvgManager& Get();
	void Init();
	std::shared_ptr<Svg> getSvg(std::string name);
	void initPopup();
	void popup(bool* p_open, bool* isOK);

public:
	std::unordered_map<std::string, SvgItem> SvgImages;
	SvgItem* SvgSelected;
	bool isTag = false;

private:
	SvgManager() {}

private:


};